﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="General.aspx.cs" Inherits="Network_General" Title="General" %>

<%@ Import Namespace="System.Net.NetworkInformation" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style type="text/css">
        .style1
        {
            color: silver;
            font-weight: bold;
            border: solid 1px Silver;
            padding-right: 5px;
            padding-left: 5px;
        }
        .style2
        {
            color: Silver;
            padding: 5px 5px 5px 10px;
            border: solid 1px Silver;
        }
        .link
        {
        	color:Silver;
        }
        
        .link:hover
        {
        	color:Black;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="Server">
    <div style="float: left; width: 45%">
        <table>
            <tr>
                <td class="style1">
                    Host name
                </td>
                <td class="style2">
                    <asp:Label ID="labHost" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    <asp:Label ID="labDomainWorkgroup" runat="server" Text="Label"></asp:Label>
                </td>
                <td class="style2">
                    <asp:Label ID="labMemberOf" runat="server" Text="Label"></asp:Label>
                </td>
            </tr>
            <tr>
                <td class="style1" style="vertical-align: top">
                    Roles
                </td>
                <td class="style2">
                    <asp:ListView ID="lvRoles" runat="server">
                        <LayoutTemplate>
                            <ul style="margin: 15px; padding: 0px">
                                <li id="itemPlaceholder" runat="server" />
                            </ul>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <li>
                                <%#Container.DataItem %></li>
                        </ItemTemplate>
                    </asp:ListView>
                </td>
            </tr>
            <tr>
                <td class="style1" style="vertical-align: top">
                    <asp:LinkButton ID="lbTcpConnections" runat="server" 
                        onclick="lbTcpConnections_Click" CssClass="link">TCP Connections</asp:LinkButton>
                </td>
                <td class="style2">
                    <%=IPGlobal.GetActiveTcpConnections().Length %>
                </td>
            </tr>
            <tr>
                <td class="style1" style="vertical-align: top">
                    <asp:LinkButton ID="lbTcpListeners" runat="server" 
                        onclick="lbTcpListeners_Click" CssClass="link">TCP Listeners</asp:LinkButton>
                </td>
                <td class="style2">
                    <%=IPGlobal.GetActiveTcpListeners().Length %>
                </td>
            </tr>
            <tr>
                <td class="style1" style="vertical-align: top">
                    <asp:LinkButton ID="lbUdpListeners" runat="server" 
                        onclick="lbUdpListeners_Click" CssClass="link">UDP Listeners</asp:LinkButton>
                </td>
                <td class="style2">
                    <%=IPGlobal.GetActiveUdpListeners().Length %>
                </td>
            </tr>
            <tr>
                <td class="style1" style="vertical-align: top">
                    NetBIOS Node Type
                </td>
                <td class="style2">
                    <%=IPGlobal.NodeType.ToString() %>
                </td>
            </tr>
            <tr>
                <td class="style1" style="vertical-align: top">
                    DHCP Scope Name
                </td>
                <td class="style2">
                    <%=IPGlobal.DhcpScopeName %>
                </td>
            </tr>
            <tr>
                <td class="style1" style="vertical-align: top">
                    DNS Domain Name
                </td>
                <td class="style2">
                    <%=IPGlobal.DomainName %>
                </td>
            </tr>
        </table>
    </div>
    <div style="float: right; width: 55%">
        <asp:UpdatePanel ID="updatePanel" runat="server">
            <ContentTemplate>
            <asp:Label ID="labWhat" runat="server" ForeColor="White"/>            
                <asp:Panel ID="panConnections" runat="server" Visible="false">
                    <asp:ListView ID="lvConnections" runat="server">
                        <LayoutTemplate>
                            <table>
                                <thead>
                                    <tr style="background-color:#999999">
                                        <th>
                                            Local
                                        </th>
                                        <th>
                                            Remote
                                        </th>
                                        <th>
                                            State
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                <tr id="itemPlaceholder" runat="server" />
                                </tbody>
                            </table>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <tr style="background-color: #CCCCCC">
                                <td>
                                    <%#Eval("LocalEndPoint") %>
                                </td>
                                <td>
                                    <%#Eval("RemoteEndPoint") %>
                                </td>
                                <td>
                                    <%#Eval("State") %>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:ListView>
                </asp:Panel>
            
                <asp:Panel ID="panListeners" runat="server" Visible="false">
                    <asp:ListView ID="lvListerners" runat="server">
                        <LayoutTemplate>
                            <table>
                                <thead>
                                    <tr style="background-color:#999999">
                                        <th>
                                            Family
                                        </th>
                                        <th>
                                            Address
                                        </th>
                                        <th>
                                            Port
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                <tr id="itemPlaceholder" runat="server" />
                                </tbody>
                            </table>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <tr style="background-color: #CCCCCC">
                                <td>
                                    <%#Eval("AddressFamily") %>
                                </td>
                                <td>
                                    <%#Eval("Address") %>
                                </td>
                                <td>
                                    <%#Eval("port") %>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:ListView>
                </asp:Panel>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="lbTcpConnections" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="lbTcpListeners" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="lbUdpListeners" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
